#ifndef _MPU_6050
#define _MPU_6050

#include "main.h"
#include "gpio.h"
#include "i2c.h"

extern int16_t accelData[3];
extern int16_t gyroData[3];
extern int16_t tempData;

#define		MPU_ADD_WRITE		(0xD0)
#define		MPU_ADD_READ		(0xD1)

#define MPU6050_XA_OFFS_H     0x06 //[15:0] XA_OFFS
#define MPU6050_XA_OFFS_L     0x07
#define MPU6050_YA_OFFS_H     0x08 //[15:0] YA_OFFS
#define MPU6050_YA_OFFS_L     0x09
#define MPU6050_ZA_OFFS_H     0x0A //[15:0] ZA_OFFS
#define MPU6050_ZA_OFFS_L_    0x0B
#define MPU6050_XG_OFFS_H     0x13 //[15:0] XG_OFFS_USR
#define MPU6050_XG_OFFS_L     0x14
#define MPU6050_YG_OFFS_H     0x15 //[15:0] YG_OFFS_USR
#define MPU6050_YG_OFFS_L     0x16
#define MPU6050_ZG_OFFS_H     0x17 //[15:0] ZG_OFFS_USR
#define MPU6050_ZG_OFFS_L     0x18


#define MPU6050_ACCEL_XOUT_H     0x3B
#define MPU6050_ACCEL_XOUT_L     0x3C
#define MPU6050_ACCEL_YOUT_H     0x3D
#define MPU6050_ACCEL_YOUT_L     0x3E
#define MPU6050_ACCEL_ZOUT_H     0x3F
#define MPU6050_ACCEL_ZOUT_L     0x40
#define MPU6050_TEMP_OUT_H       0x41
#define MPU6050_TEMP_OUT_L       0x42
#define MPU6050_GYRO_XOUT_H      0x43
#define MPU6050_GYRO_XOUT_L      0x44
#define MPU6050_GYRO_YOUT_H      0x45
#define MPU6050_GYRO_YOUT_L      0x46
#define MPU6050_GYRO_ZOUT_H      0x47
#define MPU6050_GYRO_ZOUT_L      0x48

#define MPU6050_WHO_AM_I         0x75


void MPU6050_Init(void);
uint8_t MPU6050_ReadByte(uint8_t reg);
void MPU6050_WriteByte(uint8_t reg,uint8_t data);
void MPU6050_ReadGyro(void);
void MPU6050_ReadAccel(void);
void MPU6050_ReadTemperature(void);



#endif

